/**
 * 项目中一部分页面使用的是公共模版“common-list-page”或者"common-detail-page"，
 * 有些页面使用的是特定的模版，
 * 这个方法对于使用特定模版的页面，记录下它的path、component、name，
 * 这个映射由前端这边确定并维护
 * @param {number} id 二级路由的ID
 * @param {object} route 一级路由
 *
 * 每一个映射项中
 * path: 路由路径
 * name: 路由名字
 * component: 组件的名称，其具体的路径与下方的ComponentMap中的属性对应。
 * hasDetail: 是否有详情页，默认为false
 * detailComponent: 详情页对应的组件。 默认为 common-detail-page
 */
export const routeInfoById = (id, route) => {
  const MAP_BY_ID = {
    "1": {
      path: "/home",
      name: "home",
      component: "Home"
    },
    "48": {
      path: "/home",
      name: "home",
      component: "EnglishHome"
    },
    "17": {
      // 参观导览
      path: "guide",
      name: `${route.name}-guide`,
      component: "visitGuide"
    },
    "18": {
      // 参观预约
      path: "appointment",
      name: `${route.name}-appointment`,
      component: "visitAppointment"
    },
    "24": {
      // 基本陈列
      path: "current",
      name: `${route.name}-current`,
      component: "exhibitionSpecial"
    },
    "25": {
      // 特别展览
      path: "special",
      name: `${route.name}-special`,
      component: "exhibitionSpecial"
    },
    "62": {
      // 特展回顾
      path: "previous",
      name: `${route.name}-previous`,
      component: "exhibitionSpecial"
    },
    "84": {
      // 展览众筹
      path: "crowdfunding",
      name: `${route.name}-crowdfunding`,
      component: "exhibitionCrowdfunding",
      hasDetail: true,
      detailComponent: "exhibitionCrowdfundingDetail"
    },
    "28": {
      // 典藏概况
      path: "overview",
      name: `${route.name}-overview`,
      component: "collectionState",
      hasDetail: true,
      detailComponent: "collectionStateDetail"
    },
    "29": {
      // 精品赏析
      path: "appreciation",
      name: `${route.name}-appreciation`,
      component: "collectionAppreciation",
      hasDetail: true,
      detailComponent: "collectionAppreciationDetail"
    },
    "30": {
      // 文物征集
      path: "collect",
      name: `${route.name}-collect`,
      component: "collectionCollect"
    },
    "33": {
      // 文创商品
      path: "craft",
      name: `${route.name}-craft`,
      component: "cultureCraft",
      hasDetail: true,
      detailComponent: "winchanceCraftDetail"
    },
    "34": {
      // 众筹活动
      path: "crowdfunding",
      name: `${route.name}-crowdfunding`,
      component: "cultureCrowdfunding",
      hasDetail: true,
      detailComponent: "cultureCrowdfundingDetail"
    },
    "79": {
      // 文创--投票活动
      path: "vote",
      name: `${route.name}-vote`,
      component: "cultureVote",
      hasDetail: true,
      detailComponent: "cultureVoteDetail"
      // hide: true
    },
    "36": {
      // 加入志愿者
      path: "volunteer",
      name: `${route.name}-volunteer`,
      component: "interactVolunteer"
    },
    "37": {
      // 留言薄
      path: "guestbook",
      name: `${route.name}-guestbook`,
      component: "interactGuestbook"
    },
    "38": {
      // 问卷调查
      path: "investigate",
      name: `${route.name}-investigate`,
      component: "interactInvestigate"
    },
    "46": {
      //参观路线
      path: "way",
      name: `${route.name}-way`,
      component: "visitWay",
      hasDetail: true
    },
    "9": {
      // 学习--活动资讯
      path: "news",
      name: `${route.name}-news`,
      component: "learningNews",
      hasDetail: true
    },
    "10": {
      // 学习--活动预约
      path: "appointment",
      name: `${route.name}-appointment`,
      component: "learningAppointment",
      hasDetail: true,
      detailComponent: "learningAppointmentDetail"
    },
    "12": {
      // 学习--在线学习
      path: "online",
      name: `${route.name}-online`,
      component: "learningOnline",
      hasDetail: true,
      detailComponent: "learningOnlineDetail"
    },
    "13": {
      // 学习--学习资讯
      path: "news",
      name: `${route.name}-news`,
      component: "learningNews",
      hasDetail: true,
      detailComponent: "learningNewsDetail"
    },
    "44": {
      // 学习--学习指南
      path: "guide",
      name: `${route.name}-guide`,
      component: "learningGuide",
      hasDetail: true,
      detailComponent: "learningGuideDetail"
    },
    "73": {
      // 招募--志愿者
      path: "volunteer",
      name: `${route.name}-volunteer`,
      component: "recruitmentVolunteer"
    },
    "54": {
      // Exhibitions--Special Exhibitions
      path: "special",
      name: `${route.name}-special`,
      component: "exhibitionSpecial"
    },
    "73": {
      // 加入志愿者
      path: "volunteer",
      name: `${route.name}-volunteer`,
      component: "interactVolunteer"
    },
    "85": {
      // 咨询--自定义页面
      path: "cosume",
      name: `${route.name}-cosume`,
      component: "newsCosume",
      hasDetail: true,
      detailComponent: "newsCosumeDetail"
    },
    /**
     * 以下为英文网页配置
     */
    "53": {
      // Exhibitions-Current Exhibitions
      path: "current",
      name: `${route.name}-current`,
      component: "exhibitionSpecial"
    },
    "54": {
      // Exhibitions-Special Exhibitions
      path: "special",
      name: `${route.name}-special`,
      component: "exhibitionSpecial"
    },
    "55": {
      // Exhibitions-Previous Exhibitions
      path: "previous",
      name: `${route.name}-previous`,
      component: "exhibitionSpecial"
    },
    "57": {
      // Colleaction-Overview
      path: "overview",
      name: `${route.name}-overview`,
      component: "collectionState",
      hasDetail: true,
      detailComponent: "collectionStateDetail"
    },
    "58": {
      // Colleaction-Boutique Collection
      path: "appreciation",
      name: `${route.name}-appreciation`,
      component: "collectionAppreciation",
      hasDetail: true,
      detailComponent: "collectionAppreciationDetail"
    }
  };
  return MAP_BY_ID[id];
};

/**
 * 页面component 映射表，组件名--页面URL地址，
 * key值（代表component的名称），与上面 routeInfoById  这个方法中的component的值对应。
 * value值表示组件文件所在的目录地址，与该文件的实际位置一致。地址前缀为：'@/pages'。
 */
export const componentMap = {
  // 二级页面的路径
  MJJ: "/mjj/index.vue",
  Zhuohua: "/zh/index",
  Home: "/home/index.vue",
  EnglishHome: "/home/EnglishHome.vue",
  Register: "/register/index",
  findPassword: "/register/findPassword",
  CommonListPage: "/mjj/list-page",
  News: "/news/index",
  commonListPage: "/common-page/common-list-page.vue",
  commonDetailPage: "/common-page/common-detail-page.vue",
  commonSecondaryPage: "/common-page/common-secondary-page.vue",
  visitGuide: "/visit/guide/index.vue",
  visitAppointment: "/visit/appointment/index.vue",
  exhibitionSpecial: "/exhibition/special/index.vue",
  collectionState: "/collection/state/index.vue",
  collectionAppreciation: "/collection/appreciation/index.vue",
  collectionCollect: "/collection/collect/index.vue",
  cultureCraft: "/culture/craft/index.vue",
  cultureCrowdfunding: "/culture/crowdFunding/index.vue",
  cultureVote: "/culture/vote/index.vue",
  interactVolunteer: "/recruitment/volunteer/index.vue",
  interactGuestbook: "/interact/guestbook/index.vue",
  interactInvestigate: "/interact/investigate/index.vue",
  visitWay: "/visit/way/index.vue",
  learningNews: "/learning/news/index.vue",
  learningAppointment: "/learning/appointment/index.vue",
  learningOnline: "/learning/online/index.vue",
  learningResource: "/learning/resource/index.vue",
  learningGuide: "/learning/guide/index.vue",
  recruitmentVolunteer: "/recruitment/volunteer/index.vue",
  newsCosume: "/visit/test/index.vue",
  newsCosumeDetail: "/visit/test/detail/index.vue",
  exhibitionCrowdfunding: "/exhibition/crowdFunding/index.vue",

  // 特殊详情页的路径
  collectionStateDetail: "/collection/state/collectionStateDetail.vue",
  collectionAppreciationDetail: "/collection/appreciation/detail",
  learningAppointmentDetail: "/learning/appointment/learningAppointmentDetail.vue",
  learningOnlineDetail: "/learning/online/learningOnlineDetail.vue",
  learningGuideDetail: "/learning/guide/detail.vue",
  winchanceCraftDetail: "/culture/craft/winchanceCraftDetail.vue",
  cultureCrowdfundingDetail: "/culture/crowdFunding/cultureCrowdfundingDetail.vue",
  cultureVoteDetail: "/culture/vote/cultureVoteDetail.vue",
  learningNewsDetail: "/learning/news/detail.vue",
  exhibitionCrowdfundingDetail: "/exhibition/crowdFunding/cultureCrowdfundingDetail.vue",

  // 特展相关组件
  specExhibition: "/exhibition/specExhibition/index.vue",
  specExhibitionHome: "/exhibition/specExhibition/home/index.vue",
  specExhibitionIntroduce: "/exhibition/specExhibition/intro/index.vue",
  specExhibitionExhibit: "/exhibition/specExhibition/exhibit/index.vue",
  specExhibitionScene: "/exhibition/specExhibition/scene/index.vue",
  specExhibitionExhibitList: "/exhibition/specExhibition/exhibit/list/index.vue",
  specExhibitionExhibitItem: "/exhibition/specExhibition/exhibit/list/detail.vue",

  // 个人中心相关组件
  userCenter: "/userCenter/index.vue",
  userCenterMyInfo: "/userCenter/myInfo/index.vue",
  userCenterMyInfoEdit: "/userCenter/myInfo/edit/index.vue",
  userCenterMyInfoModifyPs: "/userCenter/myInfo/modifyPS/index.vue",
  userCenterMyAppointment: "/userCenter/myAppointment/index.vue",
  userCenterMyArt: "/userCenter/myArt/index.vue",
  userCenterMyExhibition: "/userCenter/myExhibition/index.vue"
};
